<template>
  <div class="table-page-search-wrapper">
    <el-form :model="searchForm" ref="searchForm" label-width="100px" class="demo-ruleForm">
      <el-row :gutter="10">
        <div v-show="keyName === '1'">
          <el-col :md="8" :sm="12" :xs="24">
            <el-form-item label="选择日期:">
              <a-range-picker
                v-model="searchForm.zdsj"
                show-time
                style="width: 100%"
                format="YYYY-MM-DD HH:mm:ss"
                @change="cxsjChange"
              />
            </el-form-item>
          </el-col>
          <el-col :md="5" :sm="12" :xs="24">
            <el-form-item label="销售渠道:">
              <a-select v-model="searchForm.orderSource" placeholder="请选择销售渠道" style="width: 100%">
                <a-select-option v-for="item in qudaoList" :key="item.value" :value="item.value">{{
                  item.label
                }}</a-select-option>
              </a-select>
            </el-form-item>
          </el-col>
          <!-- <el-col :md="5" :sm="12" :xs="24">
            <el-form-item label="地区:">
              <a-input
                v-model="searchForm.areaName"
                placeholder="请输入地区"
              />
            </el-form-item>
          </el-col> -->
        </div>
        <div v-show="keyName === '2'">
          <el-col :md="8" :sm="12" :xs="24">
            <el-form-item label="门店:">
              <a-cascader style="width: 100%" :options="mendianList" :props="{ multiple: true }" clearable></a-cascader>
            </el-form-item>
          </el-col>
        </div>
        <div v-show="keyName === '3'">
          <el-col :md="8" :sm="12" :xs="24">
            <el-form-item label="地市选择:">
              <el-cascader style="width: 100%" :options="dishiList" clearable></el-cascader>
            </el-form-item>
          </el-col>
        </div>
        <el-col :md="6" :sm="12" :xs="24">
          <div style="margin-left: 30px">
            <a-button type="primary" icon="search" @click="searchAction()">查询</a-button>
            <a-button icon="delete" @click="resetSearch()" style="margin-left: 8px">重置</a-button>
          </div>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>
<script>
export default {
  name: 'search',
  props: ['keyName'],
  data() {
    return {
      statuslistt: [], //商品类目
      mendianList: [
        {
          value: 1,
          label: '东南',
          children: [
            //门店
            {
              value: 2,
              label: '上海',
            },
            { value: 3, label: '普陀' },
          ],
        },
      ],
      dishiList: [
        //地市选择
        {
          value: 1,
          label: '东南',
          children: [
            {
              value: 2,
              label: '上海',
              children: [
                {
                  value: 4,
                  label: '上海',
                },
              ],
            },
            { value: 3, label: '普陀' },
          ],
        },
      ],
      qudaoList: [
        {
          label: '小程序',
          value: '00',
        },
        {
          label: 'APP',
          value: '01',
        },
        {
          label: '线下',
          value: '02',
        },
      ], //销售渠道
      shangpinList: [], //商品分类
      searchForm: {},
    }
  },
  methods: {
    searchAction() {
      //执行搜索
      this.$emit('search')
    },
    resetSearch() {
      this.searchForm = {}
      this.$emit('resetSearch')
    },
    getSearchForm() {
      //获取高级搜索条件
      return {
        ...this.searchForm,
      }
    },
    cxsjChange(e) {
      var timeList = [this.formDate(e[0]._d), this.formDate(e[1]._d)]
      this.searchForm.beginTime = timeList[0]
      this.searchForm.endTime = timeList[1]
    },
  },
}
</script>


<style lang="less">
</style>>
